package com.wq.gof.designer.command;

/**
 * @Author: wangqiang20995
 * @Date:2019/1/25
 * @Description:
 * @Resource:
 */
public class CommandTest {

    public static void main(String args[]){
        Invoker invoker = new Invoker();
        Receiver receiver = new Receiver(new Wheel());

        ICommand right = new TurnRightCommand(receiver);

        invoker.setCommand(right);
        invoker.execute();

        ICommand left = new TurnLeftCommand(receiver);
        invoker.setCommand(left);
        invoker.execute();

        invoker.cancel();
    }
}
